<?php

namespace App\Http\Requests\Admin\Panx\Device;

use App\Http\Requests\ApiRequest;
use Illuminate\Foundation\Http\FormRequest;

/**
 * @property int device_id
 */
class DeviceBuyRequest extends ApiRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'sku'              => 'required|int|min:1|max:'.self::MAX_INT,
            'buyer'            => 'required|string|max:'.self::MAX_STRING,
            'purchase_at'      => 'required|date',
            'device_id'        => 'required|int|min:1|max:'.self::MAX_INT
        ];
    }

    /**
     * @return array
     */
//    public function messages()
//    {
//        return [
//            'sku.*'              => '采购数量必须大于等于1的数值',
//            'buyer.*'            => '采购人必须是字符串',
//            'purchase_at.*'      => '采购时间必须是日期',
//            'device_id.*'        => '设备型号信息必须是数值'
//        ];
//    }
}
